"""Globals and small utilities used throughout."""
FUNC_CHAR = '/'

def isFunc(node):
    """Return True if node is a function."""
    return node[0][0] == FUNC_CHAR and node[0] != FUNC_CHAR

def isCompound(node):
    """Return True if node is a compound expression (not a function or name)."""
    return not isName(node) and not isFunc(node)

def isName(node):
    """Return True if node is a name."""
    return isinstance(node, basestring)

def splitFunc(func):
    """Return (params, body)."""
    return func[0][1:], func[1]

def makeFunc(params, body):
    return [FUNC_CHAR + params, [body] if isName(body) else body]
